package main

import (
	"bufio"
	"fmt"
	"os"
)

var inputReader *bufio.Reader
var input string
var err error

func main() {
	var (
		name string
		age  int
	)
	fmt.Print("输入姓名和年龄,使用空格分隔：")
	//	fmt.Scanln(&name, &age)
	fmt.Scanf("%s : %d ", &name, &age)
	fmt.Printf("name:%s\nage::%d\n", name, age)

	//	input := "xiaowang 26"
	//	fmt.Sscan(input, &name, &age)
	//	fmt.Printf("name:%s\nage:%d\n", name, age)

	inputReader = bufio.NewReader(os.Stdin)
	fmt.Println("输入姓名：")
	input, err = inputReader.ReadString('\n')
	if err == nil {
		fmt.Printf("The input was:%s \n", input)
	}

}
